<?php
class UrlService extends FServiceBase
{
    /**
    * Log old URLs
    * 
    * @param string $ref Referrer site
    * @param string $url Requested url
    */
    public function logOldUrl($params) {
        $db = Yii::app()->db;
        $db->createCommand('INSERT INTO old_url_log(url,ref,ip,log_time) values(:url, :ref, :ip, :log_time)')->execute(array(
            ':url' => $this->getParam($params, 'url',''),
            ':ref' => $this->getParam($params, 'ref',''),
            ':ip' => Yii::app()->request->getUserHostAddress(),
            ':log_time'=>date('Y/m/d h:s:i')
        ));
    }
}
?>
